package models

import (
	"github.com/beego/beego/v2/client/orm"
	_ "github.com/go-sql-driver/mysql"
	"github.com/redis/go-redis/v9"
)

type User struct {
	Id       int
	Username string
	Password string
	Mobile   string
	Name     string
	AuthCode string
}

var Redis *redis.Client

func init() {
	orm.RegisterDriver("mysql", orm.DRMySQL)
	orm.RegisterDataBase("default", "mysql", "root:root@tcp(127.0.0.1:3306)/demo")
	orm.RegisterModel(new(User))
	orm.RunSyncdb("default", false, true)
	orm.Debug = true
	Redis = redis.NewClient(&redis.Options{
		Addr: "localhost:6379",
		DB:   0,
	})
}
